/*
 * timer.c
 *
 *  Created on: 12.05.2012
 *      Author: Eugen Schneider
 */

#include "timer.h"
bool bInitTimer(void) {

	// set up timer with prescaler = 8
	TCCR1B |= (1 << CS12) | (1 << WGM12);

	//load output compare register for an interrupt every 1s
	OCR1A = 62500;

	// initialize counter
	TCNT1 = 0;

	// enable overflow interrupt
	TIMSK |= (1 << OCIE1A);

	// enable global interrupts
	sei();

	return true;
}
